package com.foodsafe.dao.impl;

import java.util.List;

import org.springframework.stereotype.Component;

import com.foodsafe.dao.GoodsCategoryDao;
import com.foodsafe.model.Goodcategory;
import com.foodsafe.util.PageInfo;

@Component("GoodsCategoryDao")
public class GoodsCategoryDaoImpl  extends HibernateDaoImpl implements GoodsCategoryDao {

	public void deleteGoodcategory(int[] GoodcategoryIds) throws Exception {
		String ids="(";
		for (int i : GoodcategoryIds) {
			ids+=i+",";
		}
		ids=ids.substring(0,ids.length()-1)+")";
		this.getSession().createSQLQuery("delete from Goodcategory  where goodcategoryId in "+ids);
		
	}

	public List<Goodcategory> queryGoodcategory(PageInfo pageInfo)
			throws Exception {
		String hql="from Goodcategory gc";
		if(pageInfo==null){
			return this.find(hql);
		}
		return this.findPageByQuery(hql, null, pageInfo);
	}

	
}
